package priv.pront.code.lanqiao.competition.course.date0401;

import java.util.Scanner;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-04-01 16:46
 */
public class 基础迷宫 {
    static int N, M, T, total, fx, fy, sx, sy, l, r;
    static int[][] map = new int[7][7];
    static boolean[][] temp = new boolean[7][7];
    static int[] dx = {0, 0, 1, -1};
    static int[] dy = {-1, 1, 0, 0};

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        M = scanner.nextInt();
        T = scanner.nextInt(); // 障碍总数
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= M; j++) {
                map[i][j] = 1;
            }
        }
        sx = scanner.nextInt();  // 起点坐标
        sy = scanner.nextInt();
        fx = scanner.nextInt();
        fy = scanner.nextInt(); // 终点坐标
        for (int i = 1; i <= T; i++) {
            l = scanner.nextInt();
            r = scanner.nextInt();
            map[l][r] = 0;
        }
        walk(sx, sy);
        System.out.println(total);
    }

    private static void walk(int x, int y) {
        if (x == fx && y == fy) {
            total++;
            return;
        }
        for (int i = 0; i < 4; i++) {
            int newX = x + dx[i];
            int newY = y + dy[i];
//            如果该方向上能走的情况下
                if (!temp[newX][newY] && map[newX][newY] == 1) {
                    temp[x][y] = true;
                    walk(newX, newY);
                    temp[x][y] = false;
                }
        }
    }
}
